Skip to content

Preserve version specifier prefixes when applying fixes - #31

Open
tomdale wants to merge 2 commits into
mainfrom
tomdale/preserve-version-ranges
Open

Preserve version specifier prefixes when applying fixes#31
tomdale wants to merge 2 commits into
mainfrom
tomdale/preserve-version-ranges

Conversation

@tomdale

@tomdale tomdale commented Dec 11, 2025

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve user's original semver behavior when applying fixes (^15.3.0^15.3.7)
  • Add getVersionPrefix() and applyVersionPrefix() utilities
  • Display prefixed version in CLI output

Test plan

  • Unit tests for prefix extraction and application
  • End-to-end tests verifying prefix flows through analysis → fix computation
  • All 372 tests passing

When applying fixes, maintain the user's original semver behavior:
- ^15.3.0 → ^15.3.7 (preserves caret)
- ~15.3.0 → ~15.3.7 (preserves tilde)
- 15.3.0  → 15.3.7  (exact stays exact)

Added getVersionPrefix() and applyVersionPrefix() utilities, plus
end-to-end tests verifying prefix preservation through the full
analysis and fix computation flow.
@tomdale
tomdale requested a review from allenzhou101 December 11, 2025 22:06
For complex ranges that can't be safely transformed, fall back to
pinning an exact version:
- < and <= (semantics don't make sense to preserve)
- Hyphen ranges (15.0.0 - 16.0.0)
- OR ranges (^15.0.0 || ^16.0.0)
- X-ranges (15.x, 15.3.x, 15.*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants